<?php
class SlidersHelper extends AppHelper
{
	var $helpers = array('Html');
	var $zoneSliders = array();
	var $Slider;
	function show($zone)
	{
		if(!is_object($this->Slider))
		{
			$this->Slider = ClassRegistry::init('Sliders.Slider');	
		}
		$zoneSliders = $this->Slider->getZoneAddList($zone);
		$zoneSliders = array_values($zoneSliders);
		$slid = '<ol class="carousel-indicators">';
                for ($int=0; $int<count($zoneSliders); $int++){
                    $cls = '';
                    if($int==0)
                        $cls = ' class="active"';
                    $slid .= '<li data-target="#carousel-example-generic" data-slide-to="'.$int.'"'.$cls.'></li>';
                }
                $slid .= '</ol> 
                    <div class="carousel-inner"> ';
		if($zoneSliders)
		{
                    for ($int=0; $int<count($zoneSliders); $int++){
//			$randKey = 0;
//			if(count($zoneSliders) > 1)
//			{
//				$randKey = rand(0,count($zoneSliders) -1);
//			}
//			$sliderId = $zoneSliders[$randKey];
			$sliderId = $zoneSliders[$int];
			$slider = $this->Slider->getSliderInfo($sliderId);
			if($slider)
			{
                            $cls = '';
                            if($int==0)
                                $cls = ' active';
                            
                                $slid .= '<div class="item'.$cls.'">
                                            <img src="'.'/uploads'.DS.'sliders'.DS.$slider['Slider']['image'].'" width="1438">
                                             <div class="carousel-caption">
                                                 <p>'.strip_tags($slider['Slider']['text'], '<strong>').'</p>
                                                 <a href="'.$slider['Slider']['button_link'].'" class="button btn_more">'.$slider['Slider']['button_text'].'<i class="fa fa-angle-double-right"></i></a>
                                             </div>
                                         </div>';
			}
                    }
		}
                $slid .= '</div>'; 
		echo $slid;
		//ClassRegistry::getObject('view')->element('show_add',array('adData'=>$adData));
		
			
	}
}
?>